<?

#nasty hack to find the docs

global $db,$topdir,$topurl;

$id = $params["id"];

$e = $db->query1("select * from docscomment where id = ".$db->sqlint($id));

$link = $e["link"];

$dname = "$topdir/docs/ref";

$dir = opendir($dname);

$ifname = "";

while ($fname = readdir($dir)) if ($fname[0] != '.' && $fname[0] != '#' && $fname != "index.html" && is_file("$dname/$fname")) {
    foreach (file("$dname/$fname") as $line) {
        if (strstr($line,"#$link")) $ifname = $fname;
        }
    }
    
    #echo "Location: $topurl/docs/ref/$ifname#$link"; die;
header("Location: $topurl/docs/ref/$ifname#$link"); die;
?>